﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace dzs.DAL
{
	/// <summary>
	/// 数据访问类:out_storageList
	/// </summary>
	public partial class out_storageList
	{
		public out_storageList()
		{}
        #region  BasicMethod

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return DbHelperSQL.GetMaxID("out_storageList_id", "out_storageList");
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int out_storageList_id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from out_storageList");
            strSql.Append(" where out_storageList_id=@out_storageList_id");
            SqlParameter[] parameters = {
					new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
			};
            parameters[0].Value = out_storageList_id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(dzs.Model.out_storageList model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into out_storageList(");
            strSql.Append("material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone,out_storagelist_batchid,target_project)");
            strSql.Append(" values (");
            strSql.Append("@material_id,@out_storage_Estimate,@out_storage_count,@material_user_id,@check_user_id,@check_status,@deal_status,@receive_address,@receive_userName,@receive_userPhone,@out_storagelist_batchid,@target_project)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@material_id", SqlDbType.Int,4),
					new SqlParameter("@out_storage_Estimate", SqlDbType.DateTime),
					new SqlParameter("@out_storage_count", SqlDbType.Float,8),
					new SqlParameter("@material_user_id", SqlDbType.Int,4),
					new SqlParameter("@check_user_id", SqlDbType.Int,4),
					new SqlParameter("@check_status", SqlDbType.VarChar,50),
					new SqlParameter("@deal_status", SqlDbType.VarChar,50),
					new SqlParameter("@receive_address", SqlDbType.VarChar,-1),
					new SqlParameter("@receive_userName", SqlDbType.NVarChar,30),
					new SqlParameter("@receive_userPhone", SqlDbType.VarChar,20),
					new SqlParameter("@out_storagelist_batchid", SqlDbType.VarChar,100),
					new SqlParameter("@target_project", SqlDbType.VarChar,50)};
            parameters[0].Value = model.material_id;
            parameters[1].Value = model.out_storage_Estimate;
            parameters[2].Value = model.out_storage_count;
            parameters[3].Value = model.material_user_id;
            parameters[4].Value = model.check_user_id;
            parameters[5].Value = model.check_status;
            parameters[6].Value = model.deal_status;
            parameters[7].Value = model.receive_address;
            parameters[8].Value = model.receive_userName;
            parameters[9].Value = model.receive_userPhone;
            parameters[10].Value = model.out_storageList_batchID;
            parameters[11].Value = model.target_project;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(dzs.Model.out_storageList model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update out_storageList set ");
            strSql.Append("material_id=@material_id,");
            strSql.Append("out_storage_Estimate=@out_storage_Estimate,");
            strSql.Append("out_storage_count=@out_storage_count,");
            strSql.Append("material_user_id=@material_user_id,");
            strSql.Append("check_user_id=@check_user_id,");
            strSql.Append("check_status=@check_status,");
            strSql.Append("deal_status=@deal_status,");
            strSql.Append("receive_address=@receive_address,");
            strSql.Append("receive_userName=@receive_userName,");
            strSql.Append("receive_userPhone=@receive_userPhone,");
            strSql.Append("out_storagelist_batchid=@out_storagelist_batchid,");
            strSql.Append("target_project=@target_project");
            strSql.Append(" where out_storageList_id=@out_storageList_id");
            SqlParameter[] parameters = {
					new SqlParameter("@material_id", SqlDbType.Int,4),
					new SqlParameter("@out_storage_Estimate", SqlDbType.DateTime),
					new SqlParameter("@out_storage_count", SqlDbType.Float,8),
					new SqlParameter("@material_user_id", SqlDbType.Int,4),
					new SqlParameter("@check_user_id", SqlDbType.Int,4),
					new SqlParameter("@check_status", SqlDbType.VarChar,50),
					new SqlParameter("@deal_status", SqlDbType.VarChar,50),
					new SqlParameter("@receive_address", SqlDbType.VarChar,-1),
					new SqlParameter("@receive_userName", SqlDbType.NVarChar,30),
					new SqlParameter("@receive_userPhone", SqlDbType.VarChar,20),
					new SqlParameter("@out_storagelist_batchid", SqlDbType.VarChar,100),
					new SqlParameter("@target_project", SqlDbType.VarChar,50),
					new SqlParameter("@out_storageList_id", SqlDbType.Int,4)};
            parameters[0].Value = model.material_id;
            parameters[1].Value = model.out_storage_Estimate;
            parameters[2].Value = model.out_storage_count;
            parameters[3].Value = model.material_user_id;
            parameters[4].Value = model.check_user_id;
            parameters[5].Value = model.check_status;
            parameters[6].Value = model.deal_status;
            parameters[7].Value = model.receive_address;
            parameters[8].Value = model.receive_userName;
            parameters[9].Value = model.receive_userPhone;
            parameters[10].Value = model.out_storageList_batchID;
            parameters[11].Value = model.target_project;
            parameters[12].Value = model.out_storageList_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int out_storageList_id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from out_storageList ");
            strSql.Append(" where out_storageList_id=@out_storageList_id");
            SqlParameter[] parameters = {
					new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
			};
            parameters[0].Value = out_storageList_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string out_storageList_idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from out_storageList ");
            strSql.Append(" where out_storageList_id in (" + out_storageList_idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public dzs.Model.out_storageList GetModel(int out_storageList_id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone,out_storagelist_batchid,target_project from out_storageList ");
            strSql.Append(" where out_storageList_id=@out_storageList_id");
            SqlParameter[] parameters = {
					new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
			};
            parameters[0].Value = out_storageList_id;

            dzs.Model.out_storageList model = new dzs.Model.out_storageList();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public dzs.Model.out_storageList DataRowToModel(DataRow row)
        {
            dzs.Model.out_storageList model = new dzs.Model.out_storageList();
            if (row != null)
            {
                if (row["out_storageList_id"] != null && row["out_storageList_id"].ToString() != "")
                {
                    model.out_storageList_id = int.Parse(row["out_storageList_id"].ToString());
                }
                if (row["material_id"] != null && row["material_id"].ToString() != "")
                {
                    model.material_id = int.Parse(row["material_id"].ToString());
                }
                if (row["out_storage_Estimate"] != null && row["out_storage_Estimate"].ToString() != "")
                {
                    model.out_storage_Estimate = DateTime.Parse(row["out_storage_Estimate"].ToString());
                }
                if (row["out_storage_count"] != null && row["out_storage_count"].ToString() != "")
                {
                    model.out_storage_count = decimal.Parse(row["out_storage_count"].ToString());
                }
                if (row["material_user_id"] != null && row["material_user_id"].ToString() != "")
                {
                    model.material_user_id = int.Parse(row["material_user_id"].ToString());
                }
                if (row["check_user_id"] != null && row["check_user_id"].ToString() != "")
                {
                    model.check_user_id = int.Parse(row["check_user_id"].ToString());
                }
                if (row["check_status"] != null)
                {
                    model.check_status = row["check_status"].ToString();
                }
                if (row["deal_status"] != null)
                {
                    model.deal_status = row["deal_status"].ToString();
                }
                if (row["receive_address"] != null)
                {
                    model.receive_address = row["receive_address"].ToString();
                }
                if (row["receive_userName"] != null)
                {
                    model.receive_userName = row["receive_userName"].ToString();
                }
                if (row["receive_userPhone"] != null)
                {
                    model.receive_userPhone = row["receive_userPhone"].ToString();
                }
                if (row["out_storagelist_batchid"] != null)
                {
                    model.out_storageList_batchID = row["out_storagelist_batchid"].ToString();
                }
                if (row["target_project"] != null)
                {
                    model.target_project = row["target_project"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone,out_storagelist_batchid,target_project ");
            strSql.Append(" FROM out_storageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone,out_storagelist_batchid,target_project ");
            strSql.Append(" FROM out_storageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM out_storageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.out_storageList_id desc");
            }
            strSql.Append(")AS Row, T.*  from out_storageList T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "out_storageList";
            parameters[1].Value = "out_storageList_id";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  BasicMethod
        
		#region  ExtensionMethod

        /// <summary>
        /// 获得审核列表(注：alreadyCount为0时代表此项目已经出库完毕，status为0时代表此项目已经审核完毕等待出库)
        /// </summary>
        public DataSet GetCheckUser(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select distinct proid,round(alreadyCount,4) as alreadyCount,status,projectname,check_user_id   ");
            strSql.Append(" FROM VoutS ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

         /// <summary>
        /// 获得审核列表
        /// </summary>
        public DataSet GetCheckUserDetail(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select *   ");
            strSql.Append(" FROM VoutStorageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得出库物料清单
        /// </summary>
        public DataSet GetVoutStrorageSpaceList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select *   ");
            strSql.Append(" FROM VoutStrorageSpaceList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得出库单的接收地点
        /// </summary>
        public DataSet GetReceiveAdd(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select distinct receive_address   ");
            strSql.Append(" FROM VoutStorageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得出库单的接收人
        /// </summary>
        public DataSet GetReceiveUser(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select distinct receive_userName   ");
            strSql.Append(" FROM VoutStorageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得出库单的单号
        /// </summary>
        public DataSet GetBatchId(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select distinct out_storagelist_batchid   ");
            strSql.Append(" FROM out_storageList ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }



        /// <summary>
        /// 获得出库清单列表
        /// </summary>
        public DataSet GetOutStorageListDetail(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select *   ");
            strSql.Append(" FROM Vinventory ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

		#endregion  ExtensionMethod

        #region  Method

        ///// <summary>
        ///// 得到最大ID
        ///// </summary>
        //public int GetMaxId()
        //{
        //    return DbHelperSQL.GetMaxID("out_storageList_id", "out_storageList");
        //}

        ///// <summary>
        ///// 是否存在该记录
        ///// </summary>
        //public bool Exists(int out_storageList_id)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select count(1) from out_storageList");
        //    strSql.Append(" where out_storageList_id=@out_storageList_id");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = out_storageList_id;

        //    return DbHelperSQL.Exists(strSql.ToString(), parameters);
        //}


        ///// <summary>
        ///// 增加一条数据
        ///// </summary>
        //public int Add(dzs.Model.out_storageList model)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("insert into out_storageList(");
        //    strSql.Append("material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone)");
        //    strSql.Append(" values (");
        //    strSql.Append("@material_id,@out_storage_Estimate,@out_storage_count,@material_user_id,@check_user_id,@check_status,@deal_status,@receive_address,@receive_userName,@receive_userPhone)");
        //    strSql.Append(";select @@IDENTITY");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@material_id", SqlDbType.Int,4),
        //            new SqlParameter("@out_storage_Estimate", SqlDbType.DateTime),
        //            new SqlParameter("@out_storage_count", SqlDbType.Float,8),
        //            new SqlParameter("@material_user_id", SqlDbType.Int,4),
        //            new SqlParameter("@check_user_id", SqlDbType.Int,4),
        //            new SqlParameter("@check_status", SqlDbType.VarChar,50),
        //            new SqlParameter("@deal_status", SqlDbType.VarChar,50),
        //            new SqlParameter("@receive_address", SqlDbType.VarChar),
        //            new SqlParameter("@receive_userName", SqlDbType.NVarChar,30),
        //            new SqlParameter("@receive_userPhone", SqlDbType.VarChar,20)};
        //    parameters[0].Value = model.material_id;
        //    parameters[1].Value = model.out_storage_Estimate;
        //    parameters[2].Value = model.out_storage_count;
        //    parameters[3].Value = model.material_user_id;
        //    parameters[4].Value = model.check_user_id;
        //    parameters[5].Value = model.check_status;
        //    parameters[6].Value = model.deal_status;
        //    parameters[7].Value = model.receive_address;
        //    parameters[8].Value = model.receive_userName;
        //    parameters[9].Value = model.receive_userPhone;

        //    object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
        //    if (obj == null)
        //    {
        //        return 0;
        //    }
        //    else
        //    {
        //        return Convert.ToInt32(obj);
        //    }
        //}
        ///// <summary>
        ///// 更新一条数据
        ///// </summary>
        //public bool Update(dzs.Model.out_storageList model)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("update out_storageList set ");
        //    strSql.Append("material_id=@material_id,");
        //    strSql.Append("out_storage_Estimate=@out_storage_Estimate,");
        //    strSql.Append("out_storage_count=@out_storage_count,");
        //    strSql.Append("material_user_id=@material_user_id,");
        //    strSql.Append("check_user_id=@check_user_id,");
        //    strSql.Append("check_status=@check_status,");
        //    strSql.Append("deal_status=@deal_status,");
        //    strSql.Append("receive_address=@receive_address,");
        //    strSql.Append("receive_userName=@receive_userName,");
        //    strSql.Append("receive_userPhone=@receive_userPhone");
        //    strSql.Append(" where out_storageList_id=@out_storageList_id");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@material_id", SqlDbType.Int,4),
        //            new SqlParameter("@out_storage_Estimate", SqlDbType.DateTime),
        //            new SqlParameter("@out_storage_count", SqlDbType.Float,8),
        //            new SqlParameter("@material_user_id", SqlDbType.Int,4),
        //            new SqlParameter("@check_user_id", SqlDbType.Int,4),
        //            new SqlParameter("@check_status", SqlDbType.VarChar,50),
        //            new SqlParameter("@deal_status", SqlDbType.VarChar,50),
        //            new SqlParameter("@receive_address", SqlDbType.VarChar),
        //            new SqlParameter("@receive_userName", SqlDbType.NVarChar,30),
        //            new SqlParameter("@receive_userPhone", SqlDbType.VarChar,20),
        //            new SqlParameter("@out_storageList_id", SqlDbType.Int,4)};
        //    parameters[0].Value = model.material_id;
        //    parameters[1].Value = model.out_storage_Estimate;
        //    parameters[2].Value = model.out_storage_count;
        //    parameters[3].Value = model.material_user_id;
        //    parameters[4].Value = model.check_user_id;
        //    parameters[5].Value = model.check_status;
        //    parameters[6].Value = model.deal_status;
        //    parameters[7].Value = model.receive_address;
        //    parameters[8].Value = model.receive_userName;
        //    parameters[9].Value = model.receive_userPhone;
        //    parameters[10].Value = model.out_storageList_id;

        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}

        ///// <summary>
        ///// 删除一条数据
        ///// </summary>
        //public bool Delete(int out_storageList_id)
        //{

        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("delete from out_storageList ");
        //    strSql.Append(" where out_storageList_id=@out_storageList_id");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = out_storageList_id;

        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}
        ///// <summary>
        ///// 批量删除数据
        ///// </summary>
        //public bool DeleteList(string out_storageList_idlist)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("delete from out_storageList ");
        //    strSql.Append(" where out_storageList_id in (" + out_storageList_idlist + ")  ");
        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}


        ///// <summary>
        ///// 得到一个对象实体
        ///// </summary>
        //public dzs.Model.out_storageList GetModel(int out_storageList_id)
        //{

        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select  top 1 out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone from out_storageList ");
        //    strSql.Append(" where out_storageList_id=@out_storageList_id");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@out_storageList_id", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = out_storageList_id;

        //    dzs.Model.out_storageList model = new dzs.Model.out_storageList();
        //    DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
        //    if (ds.Tables[0].Rows.Count > 0)
        //    {
        //        if (ds.Tables[0].Rows[0]["out_storageList_id"] != null && ds.Tables[0].Rows[0]["out_storageList_id"].ToString() != "")
        //        {
        //            model.out_storageList_id = int.Parse(ds.Tables[0].Rows[0]["out_storageList_id"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["material_id"] != null && ds.Tables[0].Rows[0]["material_id"].ToString() != "")
        //        {
        //            model.material_id = int.Parse(ds.Tables[0].Rows[0]["material_id"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["out_storage_Estimate"] != null && ds.Tables[0].Rows[0]["out_storage_Estimate"].ToString() != "")
        //        {
        //            model.out_storage_Estimate = DateTime.Parse(ds.Tables[0].Rows[0]["out_storage_Estimate"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["out_storage_count"] != null && ds.Tables[0].Rows[0]["out_storage_count"].ToString() != "")
        //        {
        //            model.out_storage_count = decimal.Parse(ds.Tables[0].Rows[0]["out_storage_count"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["material_user_id"] != null && ds.Tables[0].Rows[0]["material_user_id"].ToString() != "")
        //        {
        //            model.material_user_id = int.Parse(ds.Tables[0].Rows[0]["material_user_id"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["check_user_id"] != null && ds.Tables[0].Rows[0]["check_user_id"].ToString() != "")
        //        {
        //            model.check_user_id = int.Parse(ds.Tables[0].Rows[0]["check_user_id"].ToString());
        //        }
        //        if (ds.Tables[0].Rows[0]["check_status"] != null && ds.Tables[0].Rows[0]["check_status"].ToString() != "")
        //        {
        //            model.check_status = ds.Tables[0].Rows[0]["check_status"].ToString();
        //        }
        //        if (ds.Tables[0].Rows[0]["deal_status"] != null && ds.Tables[0].Rows[0]["deal_status"].ToString() != "")
        //        {
        //            model.deal_status = ds.Tables[0].Rows[0]["deal_status"].ToString();
        //        }
        //        if (ds.Tables[0].Rows[0]["receive_address"] != null && ds.Tables[0].Rows[0]["receive_address"].ToString() != "")
        //        {
        //            model.receive_address = ds.Tables[0].Rows[0]["receive_address"].ToString();
        //        }
        //        if (ds.Tables[0].Rows[0]["receive_userName"] != null && ds.Tables[0].Rows[0]["receive_userName"].ToString() != "")
        //        {
        //            model.receive_userName = ds.Tables[0].Rows[0]["receive_userName"].ToString();
        //        }
        //        if (ds.Tables[0].Rows[0]["receive_userPhone"] != null && ds.Tables[0].Rows[0]["receive_userPhone"].ToString() != "")
        //        {
        //            model.receive_userPhone = ds.Tables[0].Rows[0]["receive_userPhone"].ToString();
        //        }
        //        return model;
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        ///// <summary>
        ///// 获得数据列表
        ///// </summary>
        //public DataSet GetList(string strWhere)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone ");
        //    strSql.Append(" FROM out_storageList ");
        //    if (strWhere.Trim() != "")
        //    {
        //        strSql.Append(" where " + strWhere);
        //    }
        //    return DbHelperSQL.Query(strSql.ToString());
        //}

        ///// <summary>
        ///// 获得前几行数据
        ///// </summary>
        //public DataSet GetList(int Top, string strWhere, string filedOrder)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select ");
        //    if (Top > 0)
        //    {
        //        strSql.Append(" top " + Top.ToString());
        //    }
        //    strSql.Append(" out_storageList_id,material_id,out_storage_Estimate,out_storage_count,material_user_id,check_user_id,check_status,deal_status,receive_address,receive_userName,receive_userPhone ");
        //    strSql.Append(" FROM out_storageList ");
        //    if (strWhere.Trim() != "")
        //    {
        //        strSql.Append(" where " + strWhere);
        //    }
        //    strSql.Append(" order by " + filedOrder);
        //    return DbHelperSQL.Query(strSql.ToString());
        //}

        ///// <summary>
        ///// 获取记录总数
        ///// </summary>
        //public int GetRecordCount(string strWhere)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select count(1) FROM out_storageList ");
        //    if (strWhere.Trim() != "")
        //    {
        //        strSql.Append(" where " + strWhere);
        //    }
        //    object obj = DbHelperSQL.GetSingle(strSql.ToString());
        //    if (obj == null)
        //    {
        //        return 0;
        //    }
        //    else
        //    {
        //        return Convert.ToInt32(obj);
        //    }
        //}
        ///// <summary>
        ///// 分页获取数据列表
        ///// </summary>
        //public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("SELECT * FROM ( ");
        //    strSql.Append(" SELECT ROW_NUMBER() OVER (");
        //    if (!string.IsNullOrEmpty(orderby.Trim()))
        //    {
        //        strSql.Append("order by T." + orderby);
        //    }
        //    else
        //    {
        //        strSql.Append("order by T.out_storageList_id desc");
        //    }
        //    strSql.Append(")AS Row, T.*  from out_storageList T ");
        //    if (!string.IsNullOrEmpty(strWhere.Trim()))
        //    {
        //        strSql.Append(" WHERE " + strWhere);
        //    }
        //    strSql.Append(" ) TT");
        //    strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
        //    return DbHelperSQL.Query(strSql.ToString());
        //}
        ///// <summary>
        ///// 得到一个对象实体
        ///// </summary>
        //public dzs.Model.out_storageList DataRowToModel(DataRow row)
        //{
        //    dzs.Model.out_storageList model = new dzs.Model.out_storageList();
        //    if (row != null)
        //    {
        //        if (row["out_storageList_id"] != null && row["out_storageList_id"].ToString() != "")
        //        {
        //            model.out_storageList_id = int.Parse(row["out_storageList_id"].ToString());
        //        }
        //        if (row["material_id"] != null && row["material_id"].ToString() != "")
        //        {
        //            model.material_id = int.Parse(row["material_id"].ToString());
        //        }
        //        if (row["out_storage_Estimate"] != null && row["out_storage_Estimate"].ToString() != "")
        //        {
        //            model.out_storage_Estimate = DateTime.Parse(row["out_storage_Estimate"].ToString());
        //        }
        //        if (row["out_storage_count"] != null && row["out_storage_count"].ToString() != "")
        //        {
        //            model.out_storage_count = decimal.Parse(row["out_storage_count"].ToString());
        //        }
        //        if (row["material_user_id"] != null && row["material_user_id"].ToString() != "")
        //        {
        //            model.material_user_id = int.Parse(row["material_user_id"].ToString());
        //        }
        //        if (row["check_user_id"] != null && row["check_user_id"].ToString() != "")
        //        {
        //            model.check_user_id = int.Parse(row["check_user_id"].ToString());
        //        }
        //        if (row["check_status"] != null)
        //        {
        //            model.check_status = row["check_status"].ToString();
        //        }
        //        if (row["deal_status"] != null)
        //        {
        //            model.deal_status = row["deal_status"].ToString();
        //        }
        //        if (row["receive_address"] != null && row["receive_address"].ToString() != "")
        //        {
        //            model.receive_address = row["receive_address"].ToString();
        //        }
        //        if (row["receive_userName"] != null && row["receive_userName"].ToString() != "")
        //        {
        //            model.receive_userName = row["receive_userName"].ToString();
        //        }
        //        if (row["receive_userPhone"] != null && row["receive_userPhone"].ToString() != "")
        //        {
        //            model.receive_userPhone = row["receive_userPhone"].ToString();
        //        }
        //    }
        //    return model;
        //}
        ///*
        ///// <summary>
        ///// 分页获取数据列表
        ///// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@tblName", SqlDbType.VarChar, 255),
        //            new SqlParameter("@fldName", SqlDbType.VarChar, 255),
        //            new SqlParameter("@PageSize", SqlDbType.Int),
        //            new SqlParameter("@PageIndex", SqlDbType.Int),
        //            new SqlParameter("@IsReCount", SqlDbType.Bit),
        //            new SqlParameter("@OrderType", SqlDbType.Bit),
        //            new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
        //            };
        //    parameters[0].Value = "out_storageList";
        //    parameters[1].Value = "out_storageList_id";
        //    parameters[2].Value = PageSize;
        //    parameters[3].Value = PageIndex;
        //    parameters[4].Value = 0;
        //    parameters[5].Value = 0;
        //    parameters[6].Value = strWhere;	
        //    return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        //}*/

        #endregion  Method
        
	}
}

